package objects.Enemy 
{
	import flash.geom.Point;
	import objects.Enemy;
	import objects.HealthBar.HealthBar;
	import objects.Path;
	import starling.core.Starling;
	import starling.display.MovieClip;
	import starling.display.Sprite;
	import starling.events.Event;
	/**
	 * ...
	 * @author Tuan EnemyWulf
	 */
	public class EnemyWulf extends Enemy
	{
		public var m_SpriteChnese : Sprite; 
		public function EnemyWulf(sprite: Sprite, _pos : Point, _path : Path, _id : int) 
		{
			super(sprite, _pos, _path, _id);
			
			m_Sprite = sprite;
			m_pos = _pos;
			path = _path;
			nodes = path.getNodes();
			m_id = _id;
			
			this.addEventListener(Event.ADDED_TO_STAGE, init);
			m_Sprite.addChild(this);
			
	/*		m_newAnimationState = Global.ENEMY_E_MOVE;
			m_animationState = Global.ENEMY_E_MOVE;*/
			m_movieVector = new Vector.<MovieClip>();
			
	       
/*			//velocity, mass, force, current node
			m_desiredV = new Point(1, 1);
			m_velocity = new Point( -1, -1);
			m_steeringV = new Point(0, 0);*/
			
			m_maxVelocity = 1.5;
			max_force = m_maxVelocity * 3;
			mass = 0.06;
		/*	currentNode = 0;*/
			
			//target pos
			/*m_coolDown = 0;
			m_collisionAttack = false;
			m_choosedEnemy = null;
			m_targetPos =  nodes[currentNode];*/
			
			//hp && damage && m_armor
			m_fullHp = 35;
			m_hp = 35;
			m_damage = 3;
			m_armor = Global.ARMOR_NONE;
			m_minDamage = 1;
			m_maxDamage = 3;
			
			//number solider attaking this enemy
		/*	m_countAttack = 0;*/
			
			//time stand
		/*	m_timeStand = 0;*/
			
			
			//Animation
			m_scale = 0.75;
			m_moveMovie = new MovieClip(Assets.getSpriteSheet().getTextures("ethirdmove_"), 8);
			m_moveMovie.pivotX =  m_moveMovie.width / 2;
			m_moveMovie.pivotY =  m_moveMovie.height / 2;
			
			m_moveMovie.scaleX = m_scale;
			m_moveMovie.scaleY = m_scale;
			Starling.juggler.add(m_moveMovie);
			this.addChild (m_moveMovie);
			

					
			m_standMovie =  new MovieClip(Assets.getSpriteSheet().getTextures("ethirdstand_"), 8);
			m_standMovie.pivotX =  m_standMovie.width / 2;
			m_standMovie.pivotY =  m_standMovie.height / 2;			
			m_standMovie.scaleX = m_scale;
			m_standMovie.scaleY = m_scale;
		
			
			m_attackMovie = new MovieClip(Assets.getSpriteSheet().getTextures("ethirdattack_"), 8);
			m_attackMovie.pivotX =  m_attackMovie.width / 2;
			m_attackMovie.pivotY =  m_attackMovie.height / 2;			
			m_attackMovie.scaleX = m_scale;
			m_attackMovie.scaleY = m_scale;
			
			
			m_movieVector[Global.ENEMY_E_MOVE] = m_moveMovie;
			m_movieVector[Global.ENEMY_E_STAND] = m_standMovie;
			m_movieVector[Global.ENEMY_E_ATTACKED] = m_attackMovie;
			
			m_movieVector[m_animationState].x = m_pos.x;
			m_movieVector[m_animationState].y = m_pos.y;
			
			//health bar
			m_healthBarRed = new HealthBar(Assets.getSpriteSheet().getTexture("redheathbar") );
			this.addChild (m_healthBarRed);
			m_healthBarRed.x = m_pos.x - m_movieVector[m_animationState].width/2 + 10;
			m_healthBarRed.y = m_pos.y - m_movieVector[m_animationState].height + 5;
			m_healthBarRed.scaleX = m_movieVector[m_animationState].width / m_healthBarRed.mImage.width ;
			m_healthBarRed.scaleY = 0.3;
			m_healthBarRed.ratioH = 1;
			
			m_healthBar = new HealthBar(Assets.getSpriteSheet().getTexture("heathbar") );
			this.addChild (m_healthBar);
			
			m_healthBar.x = m_pos.x - m_movieVector[m_animationState].width/2 + 10;
			m_healthBar.y = m_pos.y - m_movieVector[m_animationState].height + 5;
			m_healthBar.scaleX = m_movieVector[m_animationState].width / m_healthBar.mImage.width ;
			m_healthBar.scaleY = 0.3;
			m_healthBar.ratioH = 1;
		}
		private function init(event:Event):void
		{
			this.removeEventListener(Event.ADDED_TO_STAGE, init);
			
		}
		
	}

}